Skip to main content

📋 POD Lifecycle in Kubernetes

  1. 📝 Pod Request: A request is made to the API server using a local pod definition YAML.
  2. 📦 Persistence: The API server saves the pod info in etcd (the key-value store).
  3. 🧽 Scheduling: The Scheduler identifies unscheduled pods and assigns them to suitable nodes.
  4. ⚙️ Kubelet Reaction: The kubelet on the node notices the scheduled pod and starts the container runtime.
  5. 🐳 Container Startup: The container runtime (e.g., Docker or containerd) starts the container.
  6. 🧠 State Management: The lifecycle state of the pod is stored and updated in etcd throughout its lifecycle.

🎯 POD Statuses and Their Meaning

StatusDescriptionPossible Reasons
🟡 PendingPod has been accepted but not yet running.Image pulling, scheduling delay, insufficient resources
🟢 RunningPod is bound to a node and all containers are running or starting.Everything is healthy and operational
🔄 SucceededAll containers in the pod terminated successfully.For short-lived jobs (e.g., kubectl run)
❌ FailedAll containers terminated, and at least one failed.Container error, non-zero exit status
🔁 CrashLoopBackOffContainer fails, restarts repeatedly.App crashing, misconfiguration, missing env variables
🔍 ImagePullBackOffKubernetes can't pull the container image.Wrong image name, missing credentials, image doesn't exist
⛔ ErrImagePullKubernetes is currently unable to pull the container image.Temporary network issues, image not found, registry issue
❌ UnknownNode communication failure, status can't be determined.Node is unreachable, network partition

🔎 Investigating Pod Issues

📄 Describe the Pod​

kubectl describe pod <PodName> [-n <namespace>] [--show-events] [--kubeconfig <file>] [--context <name>]

📜 View Pod Logs​

kubectl logs <PodName> [-n <namespace>] [-c <container_name>] [--previous] [--timestamps] [--tail=<lines>] [--since=<duration>] [--follow] [--limit-bytes=<bytes>]

Let me know if you want code snippets or diagrams added as well! 🚀